package com.home.common.util;

import java.util.List;

public class CommonUtil extends Util{
	/**
	 * 
	 * @Description: if the Obj is null  or  ""
	 * @createBy:ran-qi-qiang
	 * @createdate:2012-5-22
	 * @param obj
	 * @return
	 */
	public static final boolean isEmpty(Object obj){
		if(obj == null || "".equals(obj)){
			return true;
		}
		return false;
	}
	
	/**
	 * 
	 * @Description: 判断一个数组是否为空，有，返回true,没有返回false
	 * @createBy:qiqiang ran
	 * @createdate:2012-3-23
	 * @param Object [] obj
	 * @return boolean
	 */
	public static final boolean isEmpty(Object [] objs){
		if(objs == null || objs.length == 0){
			return true;
		}
		return false;
	}
	
	/**
	 * 
	 * @Description:判断一个数组是否有元素为空
	 * @createBy:ran-qi-qiang
	 * @createdate:2012-8-30
	 * @param obj
	 * @return
	 */
	public static final boolean isExistEmpty(Object [] objs){
		if(isEmpty(objs)){
			return true;
		}
		for(Object obj : objs){
			if(isEmpty(obj)){
				return true;
			}
		}
		return false;
	}
	
	/**
	 * 
	 * @Description:判断一个List集合是否有元素为空，有，返回true,没有返回false
	 * @createBy:qiqiang ran
	 * @createdate:2012-3-23
	 * @param List<Object> obj
	 * @return boolean
	 */
	public static boolean isEmpty(List<Object> objs){
		if(objs == null || objs.size() == 0){
			return true;
		}
		return false;
	}
	
	/**
	 * 
	 * @Description:判断一个集合是否有元素为空
	 * @createBy:ran-qi-qiang
	 * @createdate:2012-8-30
	 * @param obj
	 * @return
	 */
	public static final boolean isExistEmpty(List<Object> objs){
		if(isEmpty(objs)){
			return true;
		}
		for(int i = 0;i<objs.size();i++){
			if(isEmpty(objs.get(i))){
				return true;
			}
		}
		return false;
	}
	
}
